import os.path
import sys
from string import *
from GenSqueezeFast import *
import time

def main():
    
    tstart = time.time()
    runstuf()
    tend = time.time()
    
    print 'time: %d ms' % (int((tend-tstart)*1000)) 
    
def runstuf():
    input = open(sys.argv[1]).read()
    input2 = None
    if len(sys.argv) >= 5:
        input2 = open(sys.argv[4]).read()
    if len(sys.argv) < 4:
        print 'usage: driver.py <sequencefile> <chunksize> <mismatch_ratio> [sequence2file]'
        exit(1)
    gs = GenSqueeze(input,int(sys.argv[2]),input2)
    gs.compress(float(sys.argv[3]))
    print 'compression: %0.3f%%' % ((1 - float(len("".join(gs.encoded)))/len(gs.sequence))*100)
    return gs
main()
